home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / SYNCLINK.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  7KB  |  244 lines

  1. /*
  2.  * SyncLink Multiprotocol Serial Adapter Driver
  3.  *
  4.  * Copyright (C) 1998 by Microgate Corporation
  5.  * 
  6.  * Redistribution of this file is permitted under 
  7.  * the terms of the GNU Public License (GPL)
  8.  */
  9.  
  10. #ifndef _SYNCLINK_H_
  11. #define _SYNCLINK_H_
  12.  
  13. #define BOOLEAN int
  14. #define TRUE 1
  15. #define FALSE 0
  16.  
  17. #define BIT0    0x0001
  18. #define BIT1    0x0002
  19. #define BIT2    0x0004
  20. #define BIT3    0x0008
  21. #define BIT4    0x0010
  22. #define BIT5    0x0020
  23. #define BIT6    0x0040
  24. #define BIT7    0x0080
  25. #define BIT8    0x0100
  26. #define BIT9    0x0200
  27. #define BIT10    0x0400
  28. #define BIT11    0x0800
  29. #define BIT12    0x1000
  30. #define BIT13    0x2000
  31. #define BIT14    0x4000
  32. #define BIT15    0x8000
  33. #define BIT16    0x00010000
  34. #define BIT17    0x00020000
  35. #define BIT18    0x00040000
  36. #define BIT19    0x00080000
  37. #define BIT20    0x00100000
  38. #define BIT21    0x00200000
  39. #define BIT22    0x00400000
  40. #define BIT23    0x00800000
  41. #define BIT24    0x01000000
  42. #define BIT25    0x02000000
  43. #define BIT26    0x04000000
  44. #define BIT27    0x08000000
  45. #define BIT28    0x10000000
  46. #define BIT29    0x20000000
  47. #define BIT30    0x40000000
  48. #define BIT31    0x80000000
  49.  
  50.  
  51. #define HDLC_MAX_FRAME_SIZE    4096
  52. #define MAX_ASYNC_TRANSMIT    4096
  53.  
  54. #define ASYNC_PARITY_NONE        0
  55. #define ASYNC_PARITY_EVEN        1
  56. #define ASYNC_PARITY_ODD        2
  57. #define ASYNC_PARITY_SPACE        3
  58.  
  59. #define HDLC_FLAG_UNDERRUN_ABORT7    0x0000
  60. #define HDLC_FLAG_UNDERRUN_ABORT15    0x0001
  61. #define HDLC_FLAG_UNDERRUN_FLAG        0x0002
  62. #define HDLC_FLAG_UNDERRUN_CRC        0x0004
  63. #define HDLC_FLAG_SHARE_ZERO        0x0010
  64. #define HDLC_FLAG_AUTO_CTS        0x0020
  65. #define HDLC_FLAG_AUTO_DCD        0x0040
  66. #define HDLC_FLAG_AUTO_RTS        0x0080
  67. #define HDLC_FLAG_RXC_DPLL        0x0100
  68. #define HDLC_FLAG_RXC_BRG        0x0200
  69. #define HDLC_FLAG_TXC_DPLL        0x0400
  70. #define HDLC_FLAG_TXC_BRG        0x0800
  71. #define HDLC_FLAG_DPLL_DIV8        0x1000
  72. #define HDLC_FLAG_DPLL_DIV16        0x2000
  73. #define HDLC_FLAG_DPLL_DIV32        0x0000
  74.  
  75. #define HDLC_CRC_NONE            0
  76. #define HDLC_CRC_16_CCITT        1
  77.  
  78. #define HDLC_TXIDLE_FLAGS        0
  79. #define HDLC_TXIDLE_ALT_ZEROS_ONES    1
  80. #define HDLC_TXIDLE_ZEROS        2
  81. #define HDLC_TXIDLE_ONES        3
  82. #define HDLC_TXIDLE_ALT_MARK_SPACE    4
  83. #define HDLC_TXIDLE_SPACE        5
  84. #define HDLC_TXIDLE_MARK        6
  85.  
  86. #define HDLC_ENCODING_NRZ            0
  87. #define HDLC_ENCODING_NRZB            1
  88. #define HDLC_ENCODING_NRZI_MARK            2
  89. #define HDLC_ENCODING_NRZI_SPACE        3
  90. #define HDLC_ENCODING_BIPHASE_MARK        4
  91. #define HDLC_ENCODING_BIPHASE_SPACE        5
  92. #define HDLC_ENCODING_BIPHASE_LEVEL        6
  93. #define HDLC_ENCODING_DIFF_BIPHASE_LEVEL    7
  94.  
  95. #define HDLC_PREAMBLE_LENGTH_8BITS    0
  96. #define HDLC_PREAMBLE_LENGTH_16BITS    1
  97. #define HDLC_PREAMBLE_LENGTH_32BITS    2
  98. #define HDLC_PREAMBLE_LENGTH_64BITS    3
  99.  
  100. #define HDLC_PREAMBLE_PATTERN_NONE    0
  101. #define HDLC_PREAMBLE_PATTERN_ZEROS    1
  102. #define HDLC_PREAMBLE_PATTERN_FLAGS    2
  103. #define HDLC_PREAMBLE_PATTERN_10    3
  104. #define HDLC_PREAMBLE_PATTERN_01    4
  105. #define HDLC_PREAMBLE_PATTERN_ONES    5
  106.  
  107. #define MGSL_MODE_ASYNC        1
  108. #define MGSL_MODE_HDLC        2
  109.  
  110. #define MGSL_BUS_TYPE_ISA    1
  111. #define MGSL_BUS_TYPE_EISA    2
  112. #define MGSL_BUS_TYPE_PCI    5
  113.  
  114. typedef struct _MGSL_PARAMS
  115. {
  116.     /* Common */
  117.  
  118.     unsigned long    mode;        /* Asynchronous or HDLC */
  119.     unsigned char    loopback;    /* internal loopback mode */
  120.     
  121.     /* HDLC Only */
  122.  
  123.     unsigned short    flags;
  124.     unsigned char    encoding;    /* NRZ, NRZI, etc. */
  125.     unsigned long    clock_speed;    /* external clock speed in bits per second */
  126.     unsigned char    addr_filter;    /* receive HDLC address filter, 0xFF = disable */
  127.     unsigned short    crc_type;    /* None, CRC16 or CRC16-CCITT */
  128.     unsigned char    preamble_length;
  129.     unsigned char    preamble;
  130.  
  131.     /* Async Only */
  132.  
  133.     unsigned long    data_rate;    /* bits per second */
  134.     unsigned char    data_bits;    /* 7 or 8 data bits */
  135.     unsigned char    stop_bits;    /* 1 or 2 stop bits */
  136.     unsigned char    parity;        /* none, even, or odd */
  137.  
  138. } MGSL_PARAMS, *PMGSL_PARAMS;
  139.  
  140. #define MICROGATE_VENDOR_ID 0x13c0
  141. #define SYNCLINK_DEVICE_ID 0x0010
  142. #define MGSL_MAX_SERIAL_NUMBER 30
  143.  
  144. /*
  145. ** device diagnostics status
  146. */
  147.  
  148. #define DiagStatus_OK                0
  149. #define DiagStatus_AddressFailure        1
  150. #define DiagStatus_AddressConflict        2
  151. #define DiagStatus_IrqFailure            3
  152. #define DiagStatus_IrqConflict            4
  153. #define DiagStatus_DmaFailure            5
  154. #define DiagStatus_DmaConflict            6
  155. #define DiagStatus_PciAdapterNotFound        7
  156. #define DiagStatus_CantAssignPciResources    8
  157. #define DiagStatus_CantAssignPciMemAddr        9
  158. #define DiagStatus_CantAssignPciIoAddr        10
  159. #define DiagStatus_CantAssignPciIrq        11
  160. #define DiagStatus_MemoryError            12
  161.  
  162. #define SerialSignal_DCD            0x01     /* Data Carrier Detect */
  163. #define SerialSignal_TXD            0x02     /* Transmit Data */
  164. #define SerialSignal_RI             0x04     /* Ring Indicator */
  165. #define SerialSignal_RXD            0x08     /* Receive Data */
  166. #define SerialSignal_CTS            0x10     /* Clear to Send */
  167. #define SerialSignal_RTS            0x20     /* Request to Send */
  168. #define SerialSignal_DSR            0x40     /* Data Set Ready */
  169. #define SerialSignal_DTR            0x80     /* Data Terminal Ready */
  170.  
  171.  
  172. /*
  173.  * Counters of the input lines (CTS, DSR, RI, CD) interrupts
  174.  */
  175. struct mgsl_icount {
  176.     __u32    cts, dsr, rng, dcd, tx, rx;
  177.     __u32    frame, parity, overrun, brk;
  178.     __u32    buf_overrun;
  179.     __u32    txok;
  180.     __u32    txunder;
  181.     __u32    txabort;
  182.     __u32    txtimeout;
  183.     __u32    rxshort;
  184.     __u32    rxlong;
  185.     __u32    rxabort;
  186.     __u32    rxover;
  187.     __u32    rxcrc;
  188.     __u32    rxok;
  189.     __u32    exithunt;
  190.     __u32    rxidle;
  191. };
  192.  
  193.  
  194. #define DEBUG_LEVEL_DATA    1
  195. #define DEBUG_LEVEL_ERROR     2
  196. #define DEBUG_LEVEL_INFO      3
  197. #define DEBUG_LEVEL_BH        4
  198. #define DEBUG_LEVEL_ISR        5
  199.  
  200. /*
  201. ** Event bit flags for use with MgslWaitEvent
  202. */
  203.  
  204. #define MgslEvent_DsrActive    0x0001
  205. #define MgslEvent_DsrInactive    0x0002
  206. #define MgslEvent_Dsr        0x0003
  207. #define MgslEvent_CtsActive    0x0004
  208. #define MgslEvent_CtsInactive    0x0008
  209. #define MgslEvent_Cts        0x000c
  210. #define MgslEvent_DcdActive    0x0010
  211. #define MgslEvent_DcdInactive    0x0020
  212. #define MgslEvent_Dcd        0x0030
  213. #define MgslEvent_RiActive    0x0040
  214. #define MgslEvent_RiInactive    0x0080
  215. #define MgslEvent_Ri        0x00c0
  216. #define MgslEvent_ExitHuntMode    0x0100
  217. #define MgslEvent_IdleReceived    0x0200
  218.  
  219. /* Private IOCTL codes:
  220.  *
  221.  * MGSL_IOCSPARAMS    set MGSL_PARAMS structure values
  222.  * MGSL_IOCGPARAMS    get current MGSL_PARAMS structure values
  223.  * MGSL_IOCSTXIDLE    set current transmit idle mode
  224.  * MGSL_IOCGTXIDLE    get current transmit idle mode
  225.  * MGSL_IOCTXENABLE    enable or disable transmitter
  226.  * MGSL_IOCRXENABLE    enable or disable receiver
  227.  * MGSL_IOCTXABORT    abort transmitting frame (HDLC)
  228.  * MGSL_IOCGSTATS    return current statistics
  229.  * MGSL_IOCWAITEVENT    wait for specified event to occur
  230.  */
  231. #define MGSL_MAGIC_IOC    'm'
  232. #define MGSL_IOCSPARAMS        _IOW(MGSL_MAGIC_IOC,0,sizeof(MGSL_PARAMS))
  233. #define MGSL_IOCGPARAMS        _IOR(MGSL_MAGIC_IOC,1,sizeof(MGSL_PARAMS))
  234. #define MGSL_IOCSTXIDLE        _IO(MGSL_MAGIC_IOC,2)
  235. #define MGSL_IOCGTXIDLE        _IO(MGSL_MAGIC_IOC,3)
  236. #define MGSL_IOCTXENABLE    _IO(MGSL_MAGIC_IOC,4)
  237. #define MGSL_IOCRXENABLE    _IO(MGSL_MAGIC_IOC,5)
  238. #define MGSL_IOCTXABORT        _IO(MGSL_MAGIC_IOC,6)
  239. #define MGSL_IOCGSTATS        _IO(MGSL_MAGIC_IOC,7)
  240. #define MGSL_IOCWAITEVENT    _IO(MGSL_MAGIC_IOC,8)
  241. #define MGSL_IOCCLRMODCOUNT    _IO(MGSL_MAGIC_IOC,15)
  242.  
  243. #endif /* _SYNCLINK_H_ */
  244.